package problems

import org.junit.Test;

import static org.hamcrest.Matchers.*
import static org.hamcrest.CoreMatchers.*
import static org.hamcrest.MatcherAssert.*


class PrimeTest {

	@Test
	void when2IsCheckedForBiggestPrimeWeShouldGet2() {
		assertThat new EulersSolutions().biggestPrime(2), is(2)
	}
	
	@Test
	void when3IsCheckedForBiggestPrimeWeShouldGet3() {
		assertThat new EulersSolutions().biggestPrime(3), is(3)
	}
	
	@Test
	void when4IsCheckedForBiggestPrimeWeShouldGet2() {
		assertThat new EulersSolutions().biggestPrime(4), is(2)
	}
	
	@Test
	void when10IsCheckedForBiggestPrimeWeShouldGet5() {
		assertThat new EulersSolutions().biggestPrime(10), is(5)
	}
	
	@Test
	void when13195IsSplitIntoPrimeNumbersWeShouldGet5_7_13_29 () {
		assertThat new EulersSolutions().primeNumbers(13195), hasItems(5,7,13,29)
	}
	
	
	@Test
	void when600851475143IsSplitIntoPrimeNumbersWeShouldGet71AsTheBiggestPrimeNumber() {
		assertThat new EulersSolutions().biggestPrime(600851475143), is(6857)
		
	}
	
	@Test
	void when600851475143IsSplitIntoPrimeNumbersWeShouldGet71_839_1471_6857AsPrimeNumbers() {
		assertThat new EulersSolutions().primeNumbers(600851475143), is([71,839, 1471, 6857])
		
	}
	
	
	@Test
	void when8462696833IsSplitIntoPrimeNumbersWeShouldGet3PrimeNumbers() {
		assertThat new EulersSolutions().primeNumbers(8462696833).size(), is(3)
		
	}
}
